.<?php
//缩略图*********************
//目标图(画布)
$dstW = 200;
$dstH = 100;
$dstImg = imagecreatetruecolor($dstW,$dstH);
//源图(大图)
$srcImg = imagecreatefromjpeg('./shanghai.jpg');
$srcW = imagesx($srcImg);
$srcH = imagesy($srcImg);

//($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h)
imagecopyresized($dstImg,$srcImg,0,0,0,0,$dstW,$dstH,$srcW,$srcH);
//保存图片
imagejpeg($dstImg,'./shanghai_thumb.jpg');
//销毁资源
imagedestroy($srcImg);
imagedestroy($dstImg);

